#ifndef BASICFILESYSTEM_H
#define BASICFILESYSTEM_H

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

//#ifdef linux
/* For pread()/pwrite() */
//#define _XOPEN_SOURCE 500
//#endif

#include <fuse.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <dirent.h>
#include <errno.h>
#include <sys/time.h>
#ifdef HAVE_SETXATTR
#include <sys/xattr.h>
#endif

class BasicFileSystem
{
public:
    BasicFileSystem() ;
    virtual ~BasicFileSystem() ;
public:

    virtual int fs_getattr(const char *path, struct stat *stbuf)  =0;
    virtual int fs_fgetattr(const char *path, struct stat *stbuf,
                        struct fuse_file_info *fi)=0;
    virtual int fs_access(const char *path, int mask)  =0;
    virtual int fs_readlink(const char *path, char *buf, size_t size) =0;
    virtual int fs_opendir(const char *path, struct fuse_file_info *fi)=0;

    virtual int fs_readdir(const char *path, void *buf, fuse_fill_dir_t filler,
                       off_t offset, struct fuse_file_info *fi) =0;

    virtual int fs_releasedir(const char *path, struct fuse_file_info *fi)=0;

    virtual int fs_mknod(const char *path, mode_t mode, dev_t rdev) =0;
    virtual int fs_mkdir(const char *path, mode_t mode) =0;
    virtual int fs_unlink(const char *path) =0;
    virtual int fs_rmdir(const char *path) =0;
    virtual int fs_symlink(const char *from, const char *to) =0;
    virtual int fs_rename(const char *from, const char *to) =0;
    virtual int fs_link(const char *frm, const char *to)    =0;
    virtual int fs_chmod(const char *path, mode_t mode) =0;
    virtual int fs_chown(const char *path, uid_t uid, gid_t gid) =0;
    virtual int fs_truncate(const char *path, off_t size) =0;

    virtual int fs_ftruncate(const char *path, off_t size,
                         struct fuse_file_info *fi)=0;


    virtual int fs_utimens(const char *path, const struct timespec ts[2]) =0;

    virtual int fs_create(const char *path, mode_t mode, struct fuse_file_info *fi)=0;


    virtual int fs_open(const char *path, struct fuse_file_info *fi) =0;
    virtual int fs_read(const char *path, char *buf, size_t size, off_t offset,
                    struct fuse_file_info *fi) =0;
    virtual int fs_write(const char *path, const char *buf, size_t size,
                     off_t offset, struct fuse_file_info *fi) =0;
    virtual int fs_statfs(const char *path, struct statvfs *stbuf) =0;

    virtual int fs_flush(const char *path, struct fuse_file_info *fi)=0;

    virtual int fs_release(const char *path, struct fuse_file_info *fi) =0;

    virtual int fs_fsync(const char *path, int isdatasync,
                     struct fuse_file_info *fi) =0;


#ifdef HAVE_SETXATTR
    virtual int fs_setxattr(const char *path, const char *name, const char *value,
                        size_t size, int flags) =0;

    virtual int fs_getxattr(const char *path, const char *name, char *value,
                        size_t size) =0;
    virtual int fs_listxattr(const char *path, char *list, size_t size) =0;

    virtual int fs_removexattr(const char *path, const char *name) =0;

#endif
    virtual int fs_lock(const char *path, struct fuse_file_info *fi, int cmd,
                    struct flock *lock)=0;
};

#endif // BASICFILESYSTEM_H
